{template 'header'}
<link href="./resource/css/app.css" rel="stylesheet">
<ul class="nav nav-tabs">
    <li class="active"><a href="{php echo $this->createWeburl('order');}">订单砍价详情</a></li>
</ul>
<div class="panel panel-default">
    <div class="table-responsive panel-body">
        <table class="table table-hover">
            <thead class="navbar-inner">
            <tr>
                <th style="width:80px;">id</th>
                <th style="width:80px;">用户昵称</th>
                <th style="width:80px;">订单id</th>
                <th style="width:80px;">商品id</th>
                <th style="width:80px;">砍价金额</th>
                <th style="width:80px;">砍价ip</th>
                <th style="width:80px;">设备信息</th>
                <th style="width:80px;">砍价时间</th>
            </tr>
            </thead>
            <tbody>
            {loop $bargain['list'] $k}
            <tr>
                <td>{$k['id']}</td>
                <td>{$k['nickname']}</td>
                <td>{$k['order_id']}</td>
                <td>{$k['goodName']}</td>
                <td>{$k['money']}</td>
                <td>{$k['ip']}</td>
                <td>{$k['equipment']}</td>
                <td>{php echo date('Y-m-d H:i:s', $k['created'])}</td>

            </tr>
            {/loop}
            </tbody>
        </table>
    </div>
    {$bargain['pages']}
</div>
<script type="application/javascript">
    $(function () {
        $('.delete').click(function () {
            if (!confirm('确认要删除该商品')) {
                return false;
            }
            id = $(this).data('id');
            $.post('', {id:id, op:'delete'}, function (data) {
                if (data.status == 1) {
                    location.href = location.href;
                } else {
                    alert('删除失败');
                }

            }, 'json')
        });


        $('.sort').blur(function () {
            var sort = $(this).val();
            var  id = $(this).data('id');
            $.post('', {id:id,sort:sort, op:'sort'}, function (data) {
                if (data.status == 1) {
                    location.href = location.href;
                } else {
                    alert('排序失败');
                }

            }, 'json')
        });
    });

</script>